package com.module.admin.rest.rmi.service.impl;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.Date;
import java.util.Map;

import com.module.admin.rest.rmi.service.RestDataService;
import com.module.admin.rest.service.RestLogService;
import com.system.comm.utils.FrameJsonUtil;
import com.system.comm.utils.FrameSpringBeanUtil;
import com.system.handler.model.ResponseFrame;

/**
 * rest接口
 * @author yuejing
 *
 */
@SuppressWarnings("serial")
public class RestDataServiceImpl extends UnicastRemoteObject implements RestDataService {
	
	//private static final Logger LOGGER = Logger.getLogger(RestDataServiceImpl.class);

	public RestDataServiceImpl() throws RemoteException {
		super();
	}

	@Override
	public String recordRequest(String serverAddress, Date requestTime, String url, Map<String, String> params) throws RemoteException {
		//LOGGER.info("url: " + url + "\n" + FrameJsonUtil.toString(params));
		RestLogService restLogService = FrameSpringBeanUtil.getBean(RestLogService.class);
		ResponseFrame frame = restLogService.save(serverAddress, requestTime, url, params);
		return FrameJsonUtil.toString(frame);
	}

}
